<?php if(time() <= strtotime("2013-12-23 16:00:00") && !isset($_GET['dev'])):?>
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>You2Play Award 2014</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://static.you2play.com/2013/assets/js/jquery.countdown.js"></script>

    <script type="text/javascript">
      $(function() {
        var endDate = "December 23, 2013 16:00:00";

        $('.countdown.simple').countdown({ 
			date: endDate,
          	render: function(data) {
            	$(this.el).html("<div class='date'>" + this.leadingZeros(data.days, 2) + " <span>days</span></div><div class='date'>" + this.leadingZeros(data.hours, 2) + " <span>hrs</span></div><div class='date'>" + this.leadingZeros(data.min, 2) + " <span>min</span></div><div class='date'>" + this.leadingZeros(data.sec, 2) + " <span>sec</span></div>");
          	}			
		});
      });
    </script>
	<link href="http://static.you2play.com/2013/assets/css/countdown.css" rel="stylesheet" type="text/css" media="all" />
    <meta property="fb:app_id" content="460477277322423" />
	<meta property="og:image" content="http://static.you2play.com/2013/assets/images/default/logo.png" />
	<link rel="image_src" href="http://static.you2play.com/2013/assets/images/default/logo.png" />
  </head>
  <body>
    <div id="container">
      <h1>You2Play Award 2014</h1>
      <div class="countdown simple"></div>
    </div>
  </body>
</html>
<?php else:?>
<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
    <title>You2play Award 2014</title>
	<link rel="icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<link rel="shortcut icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />	
    <meta name="title" content="You2play Award 2014" />
    <meta name="description" content="You2play Award 2014" />
    <meta name="keywords" content="You2play Award 2014" />
    <meta property="fb:app_id" content="460477277322423" />
	<?php if(!empty($fb_image)):?>
		<meta property="og:title" content="You2play Award 2014" />
		<meta property="og:description" content="You2play Award 2014" />
		<meta property="og:type" content="website" />
		<meta property="og:image" content="<?php echo image_asset_url($fb_image);?>" />
		<!--<link rel='image_src' href='<?php echo image_asset_url($fb_image);?>' />-->
	<?php else:?>
		<meta property="og:title" content="You2play Award 2014" />
		<meta property="og:description" content="You2play Award 2014" />
		<meta property="og:type" content="website" />
		<meta property="og:image" content="<?php echo image_asset_url($asset_award_image_path.'fb_like.jpg?y=2014');?>" />	
		<!--<link rel='image_src' href='<?php echo image_asset_url($asset_award_image_path.'fb_like.jpg?y=2014');?>' />-->
	<?php endif;?>
    <?php echo(meta(array('name'=>'Content-type','content'=>'text/html;charset=UTF-8','type'=>'equiv')))?>
	<script type="text/javascript">
	 	/*Set Web Path*/
		var web_path = '<?php echo $award_url;?>';
	</script>
	<?php if(!empty($ga_id)):?>
		<script type="text/javascript">
		  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
		  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
		  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
		  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

		  ga('create', 'UA-16730596-<?php echo $ga_id;?>', 'you2play.com');
		  ga('send', 'pageview');

		</script>		
		<?php if($ga_id != 1):?>
			<script type="text/javascript">
				ga('create', 'UA-16730596-1', 'you2play.com', {'name':'secondTracker'});
			  	ga('secondTracker.send', 'pageview');
			</script>						
		<?php endif;?>	
		<?php if(!empty($ga_event)):?>
			<script type="text/javascript">
				ga('send', 'event', ''+window.location.hostname+'', 'view', '<?php echo $ga_event;?>');
			</script>
			<?php if($ga_id != 1):?>
				<script type="text/javascript">
					ga('secondTracker.send', 'event', ''+window.location.hostname+'', 'view', '<?php echo $ga_event;?>');
				</script>			
			<?php endif;?>
		<?php endif;?>			
	<?php endif;?>
    <!--Load Js-->
    <?php 
    if(!empty($js)):
            foreach($js as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
                            echo js_asset($value."?v=1.1")."\n";				
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load Css-->
    <?php 
    if(!empty($css)):
            foreach($css as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/css/'.$value)) && !empty($value)):
                            echo css_asset($value."?v=1.1",'', array('media'=>'all'))."\n";			
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load External Js-->
    <?php
    if(!empty($external_js)):
	?>
	<script type="text/javascript" language="javascript">
    	<?php echo $external_js;?>
	</script>
	<?php
    endif;
    ?>
    <!--Load External Css-->
    <?php
    if(!empty($external_css)):
	?>
	<style type="text/css">
    	<?php echo $external_css;?>
	</style>
	<?php
    endif;
    ?>	
</head>
<body>
	<div id="wrapper">
		<div id="container">
			<!--Sponser-->
			<div id="sponser">
				<?php echo image_asset('award/sponser.png','',array('width' => 1156,'height' => 245));?>
			</div>
			<!--Header-->
			<div id="header">
				<!--Facebook Login-->
				<div id="fb_login">
					<div id="fb-root"></div>
					<script>
					window.fbAsyncInit = function() {
					// init the FB JS SDK
					FB.init({
					appId      : '<?php echo $this->config->item("fb_api");?>', // App ID from the App Dashboard
					//channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
					status     : true, // check the login status upon init?
					cookie     : true, // set sessions cookies to allow your server to access the session?
					xfbml      : true  // parse XFBML tags on this page?
					});

					// Additional initialization code such as adding Event Listeners goes here
					FB.getLoginStatus(function(response) {
					if (response.status === 'connected') {
					// connected
					var fb_id  = "<?php echo $this->session->userdata('fb_id');?>";
					var fb_name  = "<?php echo $this->session->userdata('fb_name');?>";
					if(fb_id == '' || fb_name == ''){
					FB.api('/me', function(response) {
					$.ajax({
					url:web_path+'get_user_fb',
					type:'post',
					data:({
					user_id:response.id,
					user_name:response.name
					})
					}).done(function(data){
					window.location.href = window.location.href.replace(window.location.hash,'');
					});
					});
					//Set Loading Text
					$('#fbStatus').html('<span>ระบบกำลังโหลดข้อมูล...</span>');
					} else {
					//Set Login name
					$('#fbStatus').html('<span>สวัสดีคุณ '+fb_name+'</span> <a class="fb logout" href="javascript:void(0);" onclick="javascript:fbLogout();"></a>');
					}
					} else if (response.status === 'not_authorized') {
					// not_authorized
					$('#fbStatus').html('<a class="fb login" href="javascript:void(0);" onclick="javascript:fbLogin();"></a>');
					} else {
					// not_logged_in
					$('#fbStatus').html('<a class="fb login" href="javascript:void(0);" onclick="javascript:fbLogin();"></a>');
					}
					});
					};

					// Load the SDK's source Asynchronously
					// Note that the debug version is being actively developed and might
					// contain some type checks that are overly strict.
					// Please report such bugs using the bugs tool.
					(function(d, debug){
					var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
					if (d.getElementById(id)) {return;}
					js = d.createElement('script'); js.id = id; js.async = true;
					js.src = "//connect.facebook.net/th_TH/all" + (debug ? "/debug" : "") + ".js";
					ref.parentNode.insertBefore(js, ref);
					}(document, /*debug*/ false));

					//Login && Logout
					function fbLogin(){
					FB.login(function(response) {
					if (response.authResponse) {
					// connected
					FB.api('/me', function(response) {
					$.ajax({
					url:web_path+'get_user_fb',
					type:'post',
					data:({
					user_id:response.id,
					user_name:response.name
					})
					}).done(function(data){
					window.location.href = window.location.href.replace(window.location.hash,'');
					});
					});
					} else {
					// cancelled
					//window.location.href = window.location.href.replace(window.location.hash,'');
					}
					},{scope: 'email,publish_actions,read_stream,offline_access'});
					}

					function fbLogout(){
					FB.logout(function(response) {
					// user is now logged out
					$.ajax({
					url:web_path+'delete_user_fb',
					type:'get'
					}).done(function(data){
					window.location.href = window.location.href.replace(window.location.hash,'');
					});
					});
					}
					</script>
					<div id="fbStatus"></div>			
				</div>			
				<!--Logo-->
				<a href="<?php echo $award_url;?>" id="logo">&nbsp;</a>
				<!--Navigator Menu-->
				<ul id="nav_menu">
					<li><a href="<?php echo $award_url.'vote';?>" target="_self" class="menu vote">VOTE</a></li>
					<li><a href="javascript:void(0);<?php //echo $award_url.'show';?>" target="_self" class="menu show">SHOW</a></li>
					<li><a href="<?php echo $award_url.'video';?>" target="_self" class="menu video">VIDEO</a></li>
					<li><a href="<?php echo $award_url.'photo';?>" target="_self" class="menu photo">PHOTO</a></li>
					<li><a href="javascript:void(0);<?php //echo $award_url.'news';?>" target="_self" class="menu news">NEWS</a></li>
					<li><a href="<?php echo $award_url.'ment';?>" target="_self" class="menu ment">MENT</a></li>
					<li><a href="<?php echo $main_url;?>" target="_self" class="menu you2play">You2Play</a></li>
				</ul>
				<!--Tag Lines-->
				<?php 
					switch($this->router->method):
						case "about":
						case "show":
						case "video":
							echo "<div id=\"taglinesAbout\">".image_asset('award/about_taglines.png','',array('width' => 589,'height' => 81))."</div>";
						break;
						case "vote":
							echo "<div id=\"taglinesAbout\">".image_asset('award/vote_taglines.png','',array('width' => 571,'height' => 94))."</div>";
						break;
						default:
							//echo "<div id=\"taglinesText\">เตรียมตัวต้องมนต์สะกดกันไว้ให้ดีกับงานประกาศ ผลรางวัลทางดนตรีแห่งปี<br /> “You2Play Awards 2014” ที่จะร่ายเวทย์แห่งเสียงเพลง สีสัน<br /> และความมันส์ขั้นสุด ให้คุณหฤหรรษ์กันสุดขั้ว<br /> 11 กุมภาพันธ์ นี้ ที่ รอยัล พารากอน ฮอลล์</div><a href=\"".$award_url.'about'."\" target=\"_self\" class=\"btnMore\"></a>";
							echo "<div id=\"taglinesText\">เตรียมตัวต้องมนต์สะกดกันไว้ให้ดีกับงานประกาศ ผลรางวัลทางดนตรีแห่งปี<br />“You2Play Awards 2014” ที่จะร่ายเวทย์แห่งเสียงเพลง สีสัน<br />และความมันส์ขั้นสุด ให้คุณหฤหรรษ์กันสุดขั้ว</div>";					
						break;
					endswitch;
				?>
			</div>			
			<!--Content-->
			<div id="content"><?php echo $this->load->view($content);?></div>
		</div>
	</div>
	<div id="footer_external">
     	<div id="footer">
			<div id="footer-logo-detail">
				<ul>
					<li class="first"><a href="http://www.you2play.com" title="หน้าแรก">หน้าแรก</a>|</li>
					<li><a href="http://artist.you2play.com/" title="">ศิลปิน</a>|</li>
					<li> <a href="http://music.you2play.com/" title="ฟังเพลง">ฟังเพลง</a>|</li>
					<li><a href="http://video.you2play.com/" title="วีดีโอ">วีดีโอ</a>|</li>
					<li><a href="http://www.you2play.com/live/" title="you2playTV">ดูทีวี</a>|</li>
					<li><a href="http://movie.you2play.com/" title="ดูหนัง">ดูหนัง</a>|</li>
					<li><a href="http://www.you2play.com/news/" title="ข่าวและกิจกรรม">ข่าวบันเทิง</a>|</li>
					<li><a href="http://fashion.you2play.com/" title="แฟชั่น">แฟชั่น</a>|</li>
					<li><a href="http://saranair.you2play.com/" title="สาระแน" class="saranair">ตลก</a>|</li>
					<li><a href="http://www.you2play.com/shop/" title="ซื้อซีดี">ช้อปปิ้ง</a>|</li>
					<li><a href="http://www.you2play.com/member/profile/" title="มุมสมาชิก">มุมสมาชิก</a>|</li>
					<li><a href="http://www.you2play.com/contact/" title="ติดต่อเรา">ติดต่อเรา</a>|</li>
					<li><a href="http://www.you2play.com/content/advertising/" title="ติดต่อโฆษณา" class="advertising">ติดต่อโฆษณา</a></li>
				</ul>
				<div>
					หากคุณต้องการ แนะนำ ติ-ชม หรือมีข่าวสารที่น่าสนใจต้องการนำเสนอผ่านเว็บไซต์ <a title="ฟังเพลง" href="http://www.you2play.com">you2play.com</a> ติดต่อมาที่ <a href="mailto:webmaster@you2play.com" title="webmaster@you2play.com" target="_blank">webmaster@you2play.com</a>
					<!--True Hits-->
					<span id="true_hits">
						<iframe src="<?php echo base_url('truehitsstat.php');?>" width="14" height="17" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" allowtransparency="true"></iframe>						
					</span>
				</div>
			</div>
     	</div>
 	</div>
	<div id="toTop">^ Back to Top</div>
	<!--Popup Page-->
	<?php if(!empty($active_popup_page)):?>
		<script type="text/javascript" language="javascript">
		    (function($) {
		        /*whatever jQuery stuff*/
		        $(function(){
					//Colorbox
					$.colorbox({
						open:true,
						width:784,
						height:579,
						href:"<?php echo image_asset_url('award/popup.png');?>",
						scrolling:false
					});
		        });
		    })(jQuery);
		</script>
	<?php endif;?>	
</body>
</html>
<?php endif;?>